package com.yan.demo;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author taoge
 * @Date 2024/7/31 13:59
 * @Description
 */
public class Demo4 {
    public static void main(String[] args) {
        String[] arr = {"1", "2", "3", "4", "5"};
        reverse(arr);
        Student1[] arrn1 = {new Student1("liusan", 22, 100.0), new Student1("lisi", 21, 90.0), new Student1("wangwu", 20, 96.0), new Student1("sanliu", 18, 80.0)};
        reverse(arrn1);
    }

    public static <T> void reverse(T[] arr) {
        for (int i = 0, j = arr.length - 1; i < arr.length / 2; i++, j--) {
            T temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
        System.out.println(Arrays.toString(arr));
    }

}

